package com.uwlaser.service.mapper;

import com.uwlaser.base.CommonMapper;
import com.uwlaser.domain.FactoryModel;
import com.uwlaser.domain.FactoryTreePathInfo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
* @author Hongchuangbin
* @date 2022-05-20
*/
@Repository
public interface FactoryTreePathInfoMapper extends CommonMapper<FactoryTreePathInfo> {

    /**
     * 查询所有父节点(传descendant)或子节点(传ancestor)
     * @param factoryTreePathInfo 查询参数
     * @return List<FactoryModel>
     */
    List<FactoryModel> queryAllFamily(FactoryTreePathInfo factoryTreePathInfo);

    /**
     * 有新的节点插入时，插入和更新关系表数据
     * @param factoryTreePathInfo 新节点
     * @return 影响行数
     */
    int insertTreePathInfo(FactoryTreePathInfo factoryTreePathInfo);

    /**
     * 删除所有子节点
     * @param ids id集合
     * @return 影响行数
     */
    int delAllChildren(@Param("ids") List<Integer> ids);
}
